import {createBrowserRouter} from 'react-router-dom'
import App from '../App'

const router=createBrowserRouter([
    {
        path:'/',
        element:<App></App>,
        children:[
            {
                path:'/index',
                lazy:async()=>{
                    const {default:Index}= await import('../pages/index/Index');
                    return {
                        element:<Index></Index>
                    }
                }
            },
            {
                path:'/class',
                lazy:async()=>{
                    const {default:Class}= await import('../pages/class/Index');
                    return {
                        element:<Class></Class>
                    }
                }
            },
            {
                path:'/user',
                lazy:async()=>{
                    const {default:User}= await import('../pages/user/Index');
                    return {
                        element:<User></User>
                    }
                }
            },
            {
                path:'/home',
                lazy:async()=>{
                    const {default:Home}= await import('../pages/home/Index');
                    return {
                        element:<Home></Home>
                    }
                }
            },
        ]
    },
    {
                path:'/list',
                lazy:async()=>{
                    const {default:List}= await import('../pages/list/Index');
                    return {
                        element:<List></List>
                    }
                }
            },
            {
                path:'/detail',
                lazy:async()=>{
                    const {default:Detail}= await import('../pages/detail/Index');
                    return {
                        element:<Detail></Detail>
                    }
                }
            },
            {
                path:'/pay',
                lazy:async()=>{
                    const {default:Pay}= await import('../pages/pay/Index');
                    return {
                        element:<Pay></Pay>
                    }
                }
            }
])
export default router